package com.wut.core.common.vo;

import cn.hutool.http.HttpStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("服务异常返回数据格式")
public class ErrorResponse implements Serializable {

    @ApiModelProperty(value = "异常状态码", example = "500")
    private int code;
    @ApiModelProperty(value = "异常响应信息", example = "内部错误")
    private String message;
    @ApiModelProperty(value = "请求路径", example = "")
    private String requestURI;
    @ApiModelProperty(value = "请求方式", example = "GET")
    private String requestMethod;
    @ApiModelProperty(value = "请求ID", example = "")
    private String requestId;

    public ErrorResponse(Integer code, String message, String requestURI) {
        this.code = code;
        this.message = message;
        this.requestURI = requestURI;
    }

    public ErrorResponse(String message, String requestURI) {
        this.code = HttpStatus.HTTP_INTERNAL_ERROR;
        this.message = message;
        this.requestURI = requestURI;
    }

    private static final long serialVersionUID = 1L;
}